package DesignPattern.PrototypePattern.demo2;

import java.io.IOException;

/**
 * Created by User on 2017/12/18.
 */
public class App {


    public static void main(String[] args) throws IOException, ClassNotFoundException {

        PrototypeManager prototypeManager = PrototypeManager.getInstance();

        prototypeManager.addPrototype(new FAR().setDisplay("I'm FAR"));
        prototypeManager.addPrototype(new SAS().setDescription("hello SAS"));

        FAR far = prototypeManager.getPrototype(FAR.class);
        SAS sas = prototypeManager.getPrototype(SAS.class);

        System.out.println(prototypeManager.getPrototype(FAR.class) == prototypeManager.getPrototype(FAR.class));
        System.out.println(prototypeManager.getPrototype(SAS.class) == prototypeManager.getPrototype(SAS.class));
    }
}
